<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="renderer" content="webkit">
		<meta name="applicable-device" content="pc,mobile">
    <title>详情页</title>
    <!-- 使用load标签加载资源文件 -->
    <link rel="stylesheet" type="text/css" href="./assets/css/bootstrap.min.css">
    <script type="text/javascript" src="./assets/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="./assets/js/bootstrap.min.js"></script>
</head>
<body>
<!-- 创建栅格布局 -->
<div class="container">
<jsp:include page="header1.jsp"></jsp:include>
    <!-- 主体 -->
    <div class="row">
        <!-- 左侧8列 -->
        <div class="col-md-8">
            <!-- 页头 -->
            <div class="page-header"><h2>PHP</h2></div>
            <div>

                <h4>PHP与Ajax操作</h4>
                <p>作者:admin&nbsp;&nbsp;
                    发布时间:2018年02月01日&nbsp;&nbsp;
                    阅读量:6&nbsp;&nbsp;

                </p>
                <div><font color="#cc9933">PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作PHP与Ajax操作
                </font></div>
                <hr>
                <button type="button" class="btn btn-default" id="fav" user_id="4" article_id="17" session_id="">收藏</button>
            </div>
            <!-- 处理收藏功能 -->
            <script type="text/javascript">
                $(function () {
                    $('#fav').on('click', function () {



                        //获取当前的用户id与栏目id,因为收藏表中有这二个字段
                        var userId = $(this).attr('user_id')
                        var artId = $(this).attr('article_id')
                        var sessionId = $(this).attr('session_id')
                        if (userId && artId) {
                            $.ajax(
                                {
                                    type: 'get',
                                    url: "/index.php/index/index/fav.html",
                                    data: {
                                        user_id: userId,
                                        article_id: artId,
                                        session_id: sessionId,
                                        time: new Date().getTime()
                                    },
                                    dataType: 'json',
                                    success: function (data) {
                                        switch (data.status) {
                                            case 1:
                                                $('#fav').attr('class', 'btn btn-success')
                                                $('#fav').text(data.message)
                                                break

                                            case 0:
                                                $('#fav').attr('class', 'btn btn-default')
                                                $('#fav').text(data.message)
                                                break

                                            case -1:
                                                alert(data.message)
                                                break

                                            case -2:
                                                alert(data.message)
                                                break

                                        }
                                    }
                                }
                            )
                        }

                    })
                })
            </script>
            <!-- 右侧4列 -->
        </div>
        <div class="col-md-4">
            <div class="page-header"><h2>热门浏览</h2></div>
            <!-- 列表使用:列表组来做 -->
            <div class="list-group">
                <a href="detail.html" class="list-group-item active">自己动手写框架教程<span class="badge">4</span></a>
                <a href="detail.html" class="list-group-item">自己动手写框架教程<span class="badge">4</span></a>
                <a href="detail.html" class="list-group-item">自己动手写框架教程<span class="badge">4</span></a>
                <a href="detail.html" class="list-group-item">自己动手写框架教程<span class="badge">4</span></a>
                <a href="detail.html" class="list-group-item">自己动手写框架教程<span class="badge">4</span></a>
                <a href="detail.html" class="list-group-item">自己动手写框架教程<span class="badge">4</span></a>
                <a href="detail.html" class="list-group-item">自己动手写框架教程<span class="badge">4</span></a>
                <a href="detail.html" class="list-group-item">自己动手写框架教程<span class="badge">4</span></a>
                <a href="detail.html" class="list-group-item">自己动手写框架教程<span class="badge">4</span></a>
                <a href="detail.html" class="list-group-item">自己动手写框架教程<span class="badge">4</span></a>
                <a href="detail.html" class="list-group-item">自己动手写框架教程<span class="badge">4</span></a>
                <a href="detail.html" class="list-group-item">自己动手写框架教程<span class="badge">4</span></a>
            </div>
        </div>
        <!-- 底部开始 -->
    </div>
</div>

<!-- 底部结束 -->
</body>
</html>